/*
 * @Author: WangLi
 * @Date: 2021-07-28 08:44:33
 * @LastEditors: WangLi
 * @LastEditTime: 2021-08-29 16:18:37
 * @Description:
 */
Component({
  externalClasses: ["custom-class"],
  options: {
    multipleSlots: true,
    addGlobalClass: true,
  },
  properties: {
    description: {
      type: String,
      value: "",
    },
    error: {
      type: Boolean,
      value: false,
    },
    image: {
      type: String,
      value: "",
    },
  },
  data: {
    currentDesc: "",
    currentImage: "",
  },
  lifetimes: {
    attached() {
      const { error, image, description } = this.data;
      if (error) {
        this.setData({
          currentDesc: description || "请求数据失败~",
          currentImage: image || "./error.png",
        });
      } else {
        this.setData({
          currentDesc: description || "暂无数据~",
          currentImage: image || "./empty.png",
        });
      }
    },
  },
});
